/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package io.simple.core.chain;

import io.simple.core.RequestContext;

import java.io.Closeable;
import java.nio.ByteBuffer;
import java.util.regex.Pattern;

/**
 * Request handler - processes request
 *
 * @author Tom
 */
public interface RequestHandler extends Closeable {

    /**
     * Process received request
     *
     * @param context request context
     * @return response content
     * @throws Exception on processing error, or Signal
     */
    public ByteBuffer processRequest(RequestContext context, ByteBuffer data) throws Exception;

    /**
     * What is the path to this handler? (i.e. /something/doThis)
     *
     * @return
     */
    public Pattern getPath();


}
